package com.unitd.springboot.starter.mybatis;

import com.unitd.frame.cache.comm.CacheExpires;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @desc frame-mybatis框架中需要第能够以的一些属性配置对象信息
 * 用于定义frame-mybatis框架中需要使用到的一些基础配置对象信息
 * 其中缓存的属性配置key以 unitd.mybatis 作为前缀
 * 此类相当于springMVC环境下spring-mybatis.xml文件中的定义的相关配置信息
 * @filename MybatisPluginProperties.java
 * @author Hudan
 * @version 1.0
 * @copyright www.unitd.com
 * @date 2017/12/23
 */
@ConfigurationProperties(prefix = "unitd.mybatis")
public class MybatisPluginProperties {

	/** 数据库类型,默认MySQL */
	private String dbType = "MySQL";
	/** 增删改查驱动引擎 可选值:default(默认),mapper3(集成mapper框架) */
	private String crudDriver = "mapper3";
	/** 是否启用自动缓存 */
	private boolean cacheEnabled = false;
	/** 是否启用读写分离 */
	private boolean rwRouteEnabled = false;
	/** 是否启用分库分表 */
	private boolean dbShardEnabled = false;
	/** 是否启用自动分页 */
	private boolean paginationEnabled = true;
	/** 是否启用空值缓存 */
	private boolean nullValueCache = false;
	/** 自动缓存的默认效期 */
	private long cacheExpireSeconds = CacheExpires.IN_1HOUR;
	/** 是否动态设置效期 */
	private boolean dynamicExpire = false;

	public boolean isCacheEnabled() {
		return cacheEnabled;
	}

	public void setCacheEnabled(boolean cacheEnabled) {
		this.cacheEnabled = cacheEnabled;
	}

	public boolean isRwRouteEnabled() {
		return rwRouteEnabled;
	}

	public void setRwRouteEnabled(boolean rwRouteEnabled) {
		this.rwRouteEnabled = rwRouteEnabled;
	}

	public boolean isDbShardEnabled() {
		return dbShardEnabled;
	}

	public void setDbShardEnabled(boolean dbShardEnabled) {
		this.dbShardEnabled = dbShardEnabled;
	}

	public boolean isPaginationEnabled() {
		return paginationEnabled;
	}

	public void setPaginationEnabled(boolean paginationEnabled) {
		this.paginationEnabled = paginationEnabled;
	}

	public String getDbType() {
		return dbType;
	}

	public void setDbType(String dbType) {
		this.dbType = dbType;
	}

	public String getCrudDriver() {
		return crudDriver;
	}

	public void setCrudDriver(String crudDriver) {
		this.crudDriver = crudDriver;
	}

	public boolean isNullValueCache() {
		return nullValueCache;
	}

	public void setNullValueCache(boolean nullValueCache) {
		this.nullValueCache = nullValueCache;
	}

	public long getCacheExpireSeconds() {
		return cacheExpireSeconds;
	}

	public void setCacheExpireSeconds(long cacheExpireSeconds) {
		this.cacheExpireSeconds = cacheExpireSeconds;
	}

	public boolean isDynamicExpire() {
		return dynamicExpire;
	}

	public void setDynamicExpire(boolean dynamicExpire) {
		this.dynamicExpire = dynamicExpire;
	}
}